home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / DECARBIT.C < prev    next >
C/C++ Source or Header  |  1989-06-05  |  718b  |  39 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     decarbit -- declaration d'un champ memoire comme etant un champ de bits
  5. */
  6.  
  7. /*
  8. #define debug
  9. */
  10.  
  11. /* standard include */
  12.  
  13. #include <stdio.h>
  14.  
  15. #include "bitstrg.h"
  16.  
  17. /*
  18.      declaration of a memory field as an array of bit
  19.  
  20.     return a pointer on the array parameters structure or NULL if problem
  21. */
  22.  
  23. struct SPARRAY* decarbit(ptr,nombr)
  24.     ELEBAR*        ptr;        /* pointer on the memory field */
  25.     unsigned    nombr;        /* number of elements in the field */
  26. {
  27.  
  28.     struct SPARRAY* pnt;
  29.  
  30.     if(nombr == 0) {
  31.         return(NULL);
  32.     }
  33.     if((pnt = (struct SPARRAY *) calloc (1,sizeof(struct SPARRAY))) != NULL) {
  34.         pnt->pntarray = ptr;
  35.         pnt->numlbit = (nombr * SIZE) - 1;
  36.     }
  37.     return(pnt);
  38. }
  39.